package com.dzm.phone.config;

import com.dzm.phone.utils.Result;
import com.dzm.phone.utils.ResultCode;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import java.util.HashMap;
import java.util.Map;

@Slf4j
@RestControllerAdvice
public class ExceptionConfig {

    @ExceptionHandler(Throwable.class)
    public Result handleException(Throwable e) {
        e.printStackTrace();

        return Result.error().message(e.getMessage());
    }

}
